<template>
  <div id="historical" :style="{ width }">
    <iframe id="content" :src="url" frameborder="0"></iframe>
  </div>
</template>

<script lang="ts" setup>
import { onMounted, onUpdated, ref } from "vue";
import { useRouter } from "vue-router";
const dialogVisible = ref(true);

const router = useRouter();
const url = ref<string>("");
const width = ref<string>("100%");
onUpdated(() => init());
onMounted(() => init());

const init = () => {
  console.log("查询参数:", router.currentRoute.value.query);
  url.value = router.currentRoute.value.query?.url?.toString() || "";
  width.value = router.currentRoute.value.query?.width?.toString() || "100%";
  if (width.value == "preview") {
    url.value = "http://admin.ruoyi.store/preview.html?url=" + url.value;
    width.value = "100%";
  }
};
</script>

<style lang="scss" scoped>
#historical {
  height: 100%;
  // width: 100%;
  // padding: 10px 10px;
  box-sizing: border-box;
  overflow: hidden;
}
#content {
  height: 100%;
  width: calc(100% + 0px);
}
</style>
